home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / rng.exe / RANDOM.DOC < prev    next >
Internet Message Format  |  1989-03-12  |  2KB

  1. Date: Tue, 28 Feb 89 10:29:08 PST
  2. From: MINUIT%FSU.MFENET@NMFECC.ARPA
  3. Subject: á random number generators
  4.  
  5. When I posted the code for George Marsaglia's universal random number 
  6. generator, I forgot to mention that the seed variables can only have 
  7. certain values:
  8.  
  9. i, j, and k  must be between 1 and 178 (not all of them 1)
  10. l must be in the range 0 to 168
  11.  
  12. I am posting a slightly modified version of the code that requires only two
  13. seed variables which basically have the range 0 to 30000. One nice feature 
  14. of this version is that each subsequence of numbers specified by the two 
  15. seeds has a length of approximately 10^30. If different parts of a large 
  16. calculation is being worked on by several people, each person could be 
  17. given his own IJ seed. That would leave 30000 more seeds for the individual 
  18. to use -- without fear that any part of the overall calculation would 
  19. experience correlations in the random numbers. 
  20.  
  21. Finally, it should also be noted that to save the state of the random number 
  22. generator at any point in time, you have to save the entire contents of the
  23. common block
  24.  
  25. - David LaSalle
  26. minuit%fsu@nmfecc.arpa
  27.  
  28. SCRI
  29. Florida State University
  30. Tallahassee, FL 32306-4052
  31. (904)644-1010
  32. -------------------------------------------------------------------------
  33. C This random number generator originally appeared in "Toward a Universal 
  34. C Random Number Generator" by George Marsaglia and Arif Zaman. 
  35. C Florida State University Report: FSU-SCRI-87-50 (1987)
  36. C It was later modified by F. James and published in "A Review of Pseudo-
  37. C random Number Generators" 
  38. C THIS IS THE BEST KNOWN RANDOM NUMBER GENERATOR AVAILABLE.
  39. C       (However, a newly discovered technique can yield 
  40. C         a period of 10^600. But that is still in the development stage.)
  41. C
  42. C It passes ALL of the tests for random number generators and has a period 
  43. C   of 2^144, is completely portable (gives bit identical results on all 
  44. C   machines with at least 24-bit mantissas in the floating point 
  45. C   representation). 
  46. C The algorithm is a combination of a Fibonacci sequence (with lags of 97
  47. C   and 33, and operation "subtraction plus one, modulo one") and an 
  48. C   "arithmetic sequence" (using subtraction).
  49. C
  50. C On a Vax 11/780, this random number generator can produce a number in 
  51. C    13 microseconds. 
  52. C======================================================================== 
  53.